/**
 * File: GlobalFileInfoIdx.java
 * Created by: mhaimel
 * Created on: 23 Jun 2009
 * CVS:  $Id: GlobalFileInfoIdx.java,v 1.1 2009/08/05 15:16:11 mhaimel Exp $
 */
package uk.ac.ebi.curtain.service;

import java.io.InputStream;
import java.io.OutputStream;

import uk.ac.ebi.curtain.service.impl.SimpleFileInfoIdx;
import uk.ac.ebi.curtain.utils.file.FileInfo;

import com.google.inject.ImplementedBy;

/**
 * Stores information about registered files and
 * provides an GFP (Global File Position) identifier, 
 * which describes a position in a file
 * 
 * @author mhaimel
 *
 */
@ImplementedBy(SimpleFileInfoIdx.class)
public interface GlobalFileInfoIdx {

	Integer register(FileInfo file);
	void register(Integer id,FileInfo file);
	Integer getId(FileInfo file);
	Integer getId(Long position);
	Long getStartPosition(FileInfo file);
	Long getStartPosition(Integer fileId);
	FileInfo getFileInfo(Integer fileId);
	FileInfo getFileInfo(Long position);

	Long translate2LocalPosition(Long position);

	void loadIndex(InputStream in);
	void persistIndex(OutputStream out);
}
